package com.moxi.mogublog.monitor;

import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

/**
 * 监控服务端的启动类
 *
 * @author JackLi
 * @date 2020/5/27 10:08
 */
@EnableEurekaClient
@EnableAdminServer
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class App02Monitor extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(App02Monitor.class, args);
    }

    /**
     * 使用外置的tomcat启动
     * <p/>
     * 默认的启动类要继承 SpringBootServletInitiailzer 类，并复写 configure() 方法。
     *
     * @param builder
     * @return
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(App02Monitor.class);
    }

}
